package com.ithailong.reconsitutionmassion.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置文件路径
 */
@Configuration
public class FilePathConfig implements WebMvcConfigurer {
    @Value("${my.base.path}")
    private String basePath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //和页面有关的静态目录都放在项目的static目录下
        registry.addResourceHandler("/upload/**").addResourceLocations("file:" + basePath);
    }
}
